test(postgrest): increase code coverage #651
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several updates to the
PostgREST
library, focusing on simplifying header and query management, improving JSON serialization, and adding comprehensive test coverage.Simplification of Header and Query Management:
Sources/PostgREST/PostgrestBuilder.swift
: Simplified the logic for appending or updating theprefer
header by introducing theappendOrUpdate
method.Sources/PostgREST/PostgrestTransformBuilder.swift
: Refactored multiple methods to use theappendOrUpdate
method for headers and query items, reducing code duplication and improving readability. [1] [2] [3] [4]JSON Serialization Improvements:
Sources/PostgREST/URLQueryRepresentable.swift
: Modified thestringfy
method inJSONSerialization
to return an optionalString
, ensuring safer handling of JSON serialization.Addition of New Tests:
Tests/PostgRESTTests/PostgresQueryTests.swift
: Added a new test suitePostgrestQueryTests
with various tests for thePostgrestClient
class, including tests for custom headers, non-success status codes, and different HTTP methods.Tests/PostgRESTTests/PostgrestBuilderTests.swift
: ExtendedPostgrestBuilderTests
to include tests for custom headers, error handling, and different query options.Tests/PostgRESTTests/PostgrestQueryBuilderTests.swift
: IntroducedPostgrestQueryBuilderTests
to test various query builder methods such asselect
,insert
,update
,upsert
, anddelete
.